package com.nwpu.am.utils;


/**
 * ThreadLocalUtil
 *
 * @author Roy
 * @version 1.0
 * {@code @date} 2024/6/3
 */
public class ThreadLocalUtil {
    private ThreadLocalUtil() {}

    private static final ThreadLocal<Object> USER_THREAD_LOCAL = new ThreadLocal<>();

    public static <T> void set(T t) {
        USER_THREAD_LOCAL.set(t);
    }

    @SuppressWarnings("unchecked")
    public static <T> T get() {
        return (T) USER_THREAD_LOCAL.get();
    }

    public static void remove() {
        USER_THREAD_LOCAL.remove();
    }

}